<template>
  <section>
    <div class="wrapper">
      <h2>活动专区</h2>
      <ul>
        <li @click="$troute.query('maListNow')">
          <p>当前活动参与</p>
          <span>Current activity registration</span>
        </li>
        <li @click="$troute.query('maPrevious')">
          <p>往期活动回顾</p>
          <span>Review of previous activities</span>
        </li>
        <li v-if="isShow('ALAudit')" @click="$troute.query('maList',1)">
          <p>活动审核</p>
          <span>Review activities</span>
        </li>

      </ul>
    </div>
    <tabbar :index='index'/>
  </section>
</template>
<script>
import api from "@/data/api/index.js";
import Vue from "vue";
import { Toast } from "vant";
import tabbar from "../../components/tabbar.vue";
import {mapState} from "vuex";
Vue.use(Toast);

export default {
  components: { tabbar },
  data() {
    return {
      activityId: "",
      index: 1,
    };
  },
  methods: {
    getActivityList() {
      api.activityNowList().then((res) => {
        if (res.data[0]) {
          this.activityId = res.data[0].id;
        } else {
          Toast("暂无进行中的活动！");
        }
      });
    },
    // 跳转活动详情
    tap(id) {
      var data = { id };
      this.$troute.query("maNow", data);
    },
    //根据权限判断是否显示菜单
    isShow:function (path){

      const show = this.menus.findIndex((value) => {
        return value == path
      })
      return show!=-1?true:false
    },
  },
  mounted() {
    console.log(this.menus)
  },
  computed:{
    ...mapState({
      menus: "menus"
    }),
  }
};
</script>
<style lang="scss" scoped>
.wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 25px 20px;
  h2 {
    position: relative;
    display: inline-block;
    font-size: 24px;
    margin-bottom: 25px;
    z-index: 1;
    &::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 1px;
      height: 5px;
      background-color: #c9151e;
      z-index: -1;
    }
  }
  ul li {
    margin-top: 20px;
    padding: 20px 20px 20px 80px;
    background: #fff url(../imgs/hdzq-1.png) no-repeat 20px center;
    background-size: 50px;
    border-radius: 10px;
    box-shadow: 2px 2px 8px #f2f2f2, -2px -2px 8px #f2f2f2;
    p {
      position: relative;
      font-size: 18px;
      font-weight: bold;
      &::after {
        content: "";
        position: absolute;
        top: 15px;
        right: 0;
        width: 8px;
        height: 13px;
        background: url(../imgs/more.png) no-repeat;
        background-size: contain;
      }
    }
    span {
      color: #999;
      font-size: 12px;
    }
    &:nth-child(2) {
      background-image: url(../imgs/hdzq-2.png);
    }
    &:nth-child(3) {
      background-image: url(../imgs/case-1.png);
    }
  }
}
</style>
